jQuery(document).ready(function()
    {   
        jQuery('#last_name').parent().append("<br/><span id='availability_status'></span>");  
        jQuery('#last_name, #phone_mobile').blur(function() 

        {      
            
            var name    = jQuery("#last_name").val(); 
             
            if(name.length > 3)//if the lenght greater than 3 characters
            {
			
                $("#availability_status").html('<img src="custom/themes/default/images/loadingyahoo.gif" align="absmiddle">&nbsp;Checking availability...');
                jQuery.ajax({  //Make the Ajax Request
                    type: "POST",  
/*                    url: "index.php?module=FITs&entryPoint=FITsCheckDuplicate",*/
                    url: "AjaxCheckDuplicate.php?module="+module,
                    data: {
                         module: module,
                        last_name:name,
						 phone_mobile:jQuery("#phone_mobile").val(),
                       
                        
                    },  //data
                    success: function(server_response){  

                        jQuery("#availability_status").ajaxComplete(function(event, request){ 

                            if(server_response == '0')
                            { 
							
                                 jQuery("#availability_status").html('<img src="custom/themes/default/images/available.png" align="absmiddle"> <font color="Green"> Available </font>  ');

                            }  

                            else {
                                result = server_response;//
								
                                 jQuery("#availability_status").html(result);
                            }

                        });
                    } 

                }); 

            }
            else
            {

                 //jQuery('#last_name').parent().append('<br/><font color="#cc0000">Full Name too short</font>');
				 jQuery('#availability_status').html('<font color="#cc0000">Full Name too short</font>');
                return;

            }



            return false;
        });
        
       

    });
    